<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>函数个税</title>
</head>
<body>
    <script>
        
       function myFunc(salary){

            if(salary > 7662){
                baseSalary = 7662;
            }
            else{
                baseSalary = salary;
            }
            console.log(baseSalary);
            var sanXianYiJin = baseSalary * (0.08 + 0.02 + 0.005 + 0.12);
            var yingNaShuiSuoDeE = salary - sanXianYiJin - 3500;
            var shuiLv = 0;
            var suSuanKouChuShu = 0;
            var tax = 0;
            if(yingNaShuiSuoDeE <= 0){
                return tax = 0;
            }
            else{
               if(yingNaShuiSuoDeE <= 1500){
                    shuiLv = 0.03;
                    suSuanKouChuShu = 0;
                }
                else if(yingNaShuiSuoDeE <= 4500){
                    shuiLv = 0.1;
                    suSuanKouChuShu = 105;
                }
                else if(yingNaShuiSuoDeE <= 9000){
                    shuiLv = 0.2;
                    suSuanKouChuShu = 555;
                }
                else if(yingNaShuiSuoDeE <= 35000){
                    shuiLv = 0.25;
                    suSuanKouChuShu = 1005;
                }
                else if(yingNaShuiSuoDeE <= 55000){
                    shuiLv = 0.3;
                    suSuanKouChuShu = 2755;
                }
                else if(yingNaShuiSuoDeE <= 80000){
                    shuiLv = 0.35;
                    suSuanKouChuShu = 5505;
                }
                else{
                    shuiLv = 0.45;
                    suSuanKouChuShu = 13505;
                }
                return tax = yingNaShuiSuoDeE * shuiLv - suSuanKouChuShu;
            }
        }
        var salary = 10000;
        var geshui = myFunc(salary);
        console.log(geshui);

        
    </script>
</body>
</html>